package conlon.rocketmq.service.Impl;

import conlon.rocketmq.api.DemoMqApi;
import conlon.rocketmq.api.model.DemoMqModel;
import conlon.rocketmq.mq.listen.TransactionListen;
import conlon.rocketmq.mq.listen.TransactionListen01;
import conlon.rocketmq.proxy.ProducerDefaultProxy;
import conlon.rocketmq.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author conlon
 * @since 2021-08-20
 */
@Service
public class SendServiceImpl implements SendService {

    @Autowired
    private ProducerDefaultProxy producerProxy;

    @Autowired
    private TransactionListen01 transactionListen01;

    @Autowired
    private TransactionListen transactionListen;


    @Override
    @Transactional(rollbackFor = Throwable.class)
    public void transactionSend() {
        DemoMqApi proxy = producerProxy.getTransactionProxy(DemoMqApi.class, "topic01", "tags01", transactionListen01);
        proxy.testProxySend(new DemoMqModel(), 0L, "transactionTopic01_新二轮测试_01", 1);
    }
}
